# 求完全数
import math

x=eval(input())

for i in range(2,  x+1):
    sum = 1
    factor = 2
    maxFactor = math.sqrt(i)
    while factor < maxFactor:
        if i % factor == 0:
            sum += factor + i / factor
        factor += 1
    if sum == i:
        print(i)
